using System;
using System.Collections.Generic; 
using System.Linq;  
using System.Text;  
using System.Data.Linq.Mapping;
using System.Data.Linq;
using System.ComponentModel;

namespace MRSite.Entity  
{  
	 [Table(Name = "orders")] 
	 public class Orders : Entity
	{ 
		/// <summary>
		///自增ID
		/// </summary>
		[Column(Name = "id", IsPrimaryKey = true, CanBeNull = false, IsVersion = true)]
		public override int id{ get; set; } 

		/// <summary>
		///订单号
		/// </summary>
		[Column(Name = "order_no")]
		public String order_no{ get; set; } 

		/// <summary>
		///交易号担保支付用到
		/// </summary>
		[Column(Name = "trade_no")]
		public String trade_no{ get; set; } 

		/// <summary>
		///用户ID
		/// </summary>
		[Column(Name = "user_id")]
		public int user_id{ get; set; } 

		/// <summary>
		///用户名
		/// </summary>
		[Column(Name = "user_name")]
		public String user_name{ get; set; } 

		/// <summary>
        ///支付方式 1:支付宝支付;4：微信支付；5：余额支付；6：积分支付；7：余额+积分支付；8:佣金支付;9：后台付款
		/// </summary>
		[Column(Name = "payment_id")]
		public int payment_id{ get; set; } 

		/// <summary>
		///支付手续费
		/// </summary>
		[Column(Name = "payment_fee")]
		public Decimal payment_fee{ get; set; } 

		/// <summary>
		///支付状态1未支付2已支付
		/// </summary>
		[Column(Name = "payment_status")]
		public int payment_status{ get; set; } 

		/// <summary>
		///支付时间
		/// </summary>
		[Column(Name = "payment_time")]
		public DateTime? payment_time{ get; set; } 

		/// <summary>
		///配送方式id  快递ID
		/// </summary>
		[Column(Name = "express_id")]
		public int express_id{ get; set; } 

		
		/// <summary>
		///物流费用
		/// </summary>
		[Column(Name = "express_fee")]
		public Decimal express_fee{ get; set; }


        /// <summary>
        ///快递单号
        /// </summary>
        [Column(Name = "express_no")]
        public String express_no { get; set; }

        /// <summary>
        ///快递公司名称
        /// </summary>
        [Column(Name = "express_com")]
        public String express_com { get; set; }

        /// <summary>
        ///快递公司标记
        /// </summary>
        [Column(Name = "express_code")]
        public String express_code { get; set; } 

		/// <summary>
		///发货状态1未发货2已发货
		/// </summary>
		[Column(Name = "express_status")]
		public int express_status{ get; set; } 

		/// <summary>
		///发货时间
		/// </summary>
		[Column(Name = "express_time")]
		public DateTime? express_time{ get; set; } 

		/// <summary>
		///收货人姓名
		/// </summary>
		[Column(Name = "accept_name")]
		public String accept_name{ get; set; } 

		/// <summary>
		///邮政编码
		/// </summary>
		[Column(Name = "post_code")]
		public String post_code{ get; set; } 

		/// <summary>
		///联系电话
		/// </summary>
		[Column(Name = "telphone")]
		public String telphone{ get; set; } 

		/// <summary>
		///手机
		/// </summary>
		[Column(Name = "mobile")]
		public String mobile{ get; set; } 

		/// <summary>
		///
		/// </summary>
		[Column(Name = "email")]
		public String email{ get; set; } 


         
         /// <summary>
		///所属省
		/// </summary>
        [Column(Name = "province")]
        public String province { get; set; }

        /// <summary>
        ///所属市
        /// </summary>
        [Column(Name = "city")]
        public String city { get; set; } 

		/// <summary>
		///所属区
		/// </summary>
		[Column(Name = "area")]
		public String area{ get; set; } 

		/// <summary>
		///收货地址
		/// </summary>
		[Column(Name = "address")]
		public String address{ get; set; } 

		/// <summary>
		///订单留言(买家)
		/// </summary>
		[Column(Name = "message")]
		public String message{ get; set; } 

		/// <summary>
		///订单备注
		/// </summary>
		[Column(Name = "remark")]
		public String remark{ get; set; } 

		/// <summary>
		///是否索要发票
		/// </summary>
		[Column(Name = "is_invoice")]
		public int is_invoice{ get; set; } 

		/// <summary>
		///发票抬头
		/// </summary>
		[Column(Name = "invoice_title")]
		public String invoice_title{ get; set; } 

		/// <summary>
		///税金
		/// </summary>
		[Column(Name = "invoice_taxes")]
		public Decimal invoice_taxes{ get; set; } 

		/// <summary>
		///应付商品总金额
		/// </summary>
		[Column(Name = "payable_amount")]
		public Decimal payable_amount{ get; set; } 

		/// <summary>
		///实付商品总金额(现金部分)
		/// </summary>
		[Column(Name = "real_amount")]
		public Decimal real_amount{ get; set; } 

		/// <summary>
		///订单总金额
		/// </summary>
		[Column(Name = "order_amount")]
		public Decimal order_amount{ get; set; } 

		/// <summary>
		///赠送的积分,正数赠送
		/// </summary>
		[Column(Name = "point")]
        public Decimal point { get; set; } 

		/// <summary>
		///订单状态1生成订单,2确认订单,3完成订单,4取消订单,5作废订单
		/// </summary>
		[Column(Name = "status")]
		public int status{ get; set; } 

		/// <summary>
		///下单时间
		/// </summary>
		[Column(Name = "add_time")]
		public DateTime add_time{ get; set; } 

		/// <summary>
		///确认时间
		/// </summary>
		[Column(Name = "confirm_time")]
		public DateTime? confirm_time{ get; set; } 

		/// <summary>
		///订单完成时间
		/// </summary>
		[Column(Name = "complete_time")]
		public DateTime? complete_time{ get; set; }
         
        /// <summary>
        ///提成
        /// </summary>
        [Column(Name = "sales_amount")]
        public Decimal sales_amount { get; set; } 

         /// <summary>
        ///用户删除操作
        /// </summary>
        [Column(Name = "is_show")]
        public string is_show { get; set; }

        /// <summary>
        ///订单类别(0:商城订单；1：进货区/分销订单；2：拼团订单； )
        /// </summary>
        [Column(Name = "ordertype")]
        public int ordertype { get; set; }

        /// <summary>
        /// 实际扣除积分
        /// </summary>
        [Column(Name = "sell_point")]
        public decimal sell_point { get; set; }

        // /// <summary>
        /////是否使用(换单操作时使用)
        ///// </summary>
        //[Column(Name = "is_hasuse")]
        //public int is_hasuse { get; set; }

        ///// <summary>
        /////使用时间
        ///// </summary>
        //[Column(Name = "use_time")]
        //public DateTime? use_time { get; set; }

           /// <summary>
        /// 最多可抵扣积分
        /// </summary>
        [Column(Name = "max_dkpoint")]
        public decimal max_dkpoint { get; set; }

        /// <summary>
        /// 最多赠送积分
        /// </summary>
        [Column(Name = "max_zspoint")]
        public decimal max_zspoint { get; set; }

        /// <summary>
        /// M值（分红，拼团赠送） PV值，用来给奖励
        /// </summary>
        [Column(Name = "PV")]
        public Decimal PV { get; set; }

           /// <summary>
        ///体验店id
        /// </summary>
        [Column(Name = "serviceid")]
        public string serviceid { get; set; }

          /// <summary>
        /// 产品ID
        /// </summary>
        [Column(Name = "product_id")]
        public int product_id { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        [Column(Name = "quantity")]
        public int quantity { get; set; }

        /// <summary>
        /// 产品标题
        /// </summary>
        [Column(Name = "title")]
        public string title { get; set; }

        /// <summary>
        /// 店铺id
        /// </summary>
        [Column(Name = "shopid"), DefaultValue(0)]
        public int shopid { get; set; }

          /// <summary>
        /// 是否结算佣金id
        /// </summary>
        [Column(Name = "isjiesuan"), DefaultValue(0)]
        public int isjiesuan { get; set; }

        /// <summary>
        /// 店铺设置的优惠红包
        /// </summary>
        [Column(Name = "hongbao")]
        public Decimal hongbao { get; set; }

        /// <summary>
        ///应赠送贡献值
        /// </summary>
        [Column(Name = "score"), DefaultValue(0)]
        public decimal score { get; set; }

        /// <summary>
        /// 首购奖励 赠送红包
        /// </summary>
        [Column(Name = "hongbao_first")]
        public Decimal hongbao_first { get; set; }

        /// <summary>
        /// 首购奖励 赠送贡献值
        /// </summary>
        [Column(Name = "score_first")]
        public Decimal score_first { get; set; }


        /// <summary>
        ///是否商户（包含多商家订单时为1，自营店订单为0）
        /// </summary>
        [Column(Name = "ismerch")]
        public int ismerch { get; set; }
        /// <summary>
        /// 商户ID (0为自营店，>0为店铺id)
        /// </summary>
        [Column(Name = "merchid")]
        public int merchid { get; set; }

        /// <summary>
        /// 父订单ID
        /// </summary>
        [Column(Name = "parentid")]
        public int parentid { get; set; }

        /// <summary>
        /// 是父订单 (不同商家合并订单时用到)，默认为0，有多店铺订单合并时，主订单为1，次订单为0【后台用到】
        /// </summary>
        [Column(Name = "isparent")]
        public int isparent { get; set; }

        /// <summary>
        /// 商户显示(不同商家合并订单时用到，0显示；1：不显示)【前端用到】，支付前：主订单显示，次订单不显示；支付成功后：主订单不显示，次订单显示。
        /// </summary>
        [Column(Name = "merchshow")]
        public int merchshow { get; set; }

            /// <summary>
        /// 频道：0自营店；1个人店；2企业店
        /// </summary>
        [Column(Name = "channel_id")]
        public int channel_id { get; set; }
         


        private EntitySet<OrderItem> _orderItemList;
        /// <summary>
        /// 文章类别表，主键
        /// </summary>
        [Association(Storage = "_orderItemList", ThisKey = "id", OtherKey = "order_id")]
        public EntitySet<OrderItem> OrderItemList
        {
            get { return this._orderItemList; }
            set { this._orderItemList.Assign(value); }
        }

        public Orders()
        {
            this._orderItemList = new EntitySet<OrderItem>();
        }
	 } 
}    

